#include<stdio.h>
#include<fcntl.h>
#include<unistd.h>

int main(){
    //close(1);
    FILE* fp=fopen("./test.txt","wb+");
    if(fp==NULL){
        perror("fopen error");
        return -1;
    }
    //printf("%d\n",fp->_fileno);
    //stdout->_fileno=fp->_fileno;

    dup2(fp->_fileno,1);
    printf("你好！\n");//固定操作的就是stdout
    fflush(stdout);
    fclose(fp);
    return 0;
}
